﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ultimus.WFServer;

namespace Task
{
    public class GraphicalView : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string incident = Request.QueryString["Incident"];
            string processName = Server.UrlDecode(Request.QueryString["ProcessName"].Trim());
            try
            {
                Incident objInc = new Incident();
                bool pReturnInc = objInc.LoadIncident(processName, int.Parse(incident));
               
                Incident.Status objIncStatus = new Incident.Status();
                objInc.GetIncidentStatus(out objIncStatus);
                byte[] bytesGif;
                objIncStatus.GetGraphicalStatus(objInc.strProcessName, objInc.nIncidentNo, objInc.nVersion, out bytesGif);
                Response.ContentType = "image/gif";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
                Response.BinaryWrite(bytesGif);
            }
            catch
            {
                //throw new Exception(ee.Message);
            }
        }
    }
}